package com.itchen.web;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;

/**
 * @author げっしょく
 * @date 2021/8/28
 */
@WebServlet("/demo2")
public class Test2 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        Map<String, String[]> pm = req.getParameterMap();
        for (String s : pm.keySet()) {
            System.out.print(s + " : ");
            String[] value = pm.get(s);
            for (String s1 : value) {
                System.out.print(s1 + " ");
            }
            System.out.println();

        }
        System.out.println("----------------------------");
        String[] boors = req.getParameterValues("boor");
        for (String boor : boors) {
            System.out.print(boor + "  ");
        }
        System.out.println();


        String username = req.getParameter("username");
        System.out.println(username);
        String password = req.getParameter("password");
        System.out.println(password);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

    }
}
